'use strict';

var mdNote = angular.module('mdNote', ['ngRoute','mdNote.controllers', 'mdNote.services','mdNote.filters','angular-loading-bar','angular.marked'])

// 路由配置
.config(['$routeProvider','$locationProvider',function($routeProvider,$locationProvider) {
    $routeProvider
        .when('/',{
            templateUrl:'views/about.html'
            ,controller: 'JsRdCtrl'
            ,title:'MD'
        })
        .when('/create',{
            templateUrl:"views/creator.html"
            ,controller:"CreateCtrl"
            ,title:"Creater"
        })
        .when('/editor',{
            templateUrl:"views/editor.html"
            ,controller:'EditorCtrl'
            ,title:"Editor"
        })
        .when('/menus',{
            templateUrl:"views/menus.html"
            ,controller:'MenusCtrl'
            ,title:"菜单"
        })
        .when('/about',{
            templateUrl:"views/about.html"
            ,controller:'AboutCtrl'
            ,title:"关于"
        })
        .when('/md',{
            templateUrl:"views/md.html"
            ,controller:'MdCtrl'
            ,title:"MD"
        })
        .when(/^\/[a-zA-Z0-9\.\-\_\/]+.md$/i,{
            templateUrl:"views/md.html"
            ,controller:'MdCtrl'
            ,title:"MD"
        })
        .otherwise(
            {
                //redirecTo:'/menus'
            templateUrl:"views/menus.html"
            ,controller:'MenusCtrl'
            ,title:"菜单"
            }
        );
    // 去除#
    $locationProvider.html5Mode(true).hashPrefix('!');
}])
// 异步进度条
.config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
    // cfpLoadingBarProvider.includeBar = false;
    cfpLoadingBarProvider.includeSpinner = true;
}])

.config(['markedProvider', function(markedProvider) {
    markedProvider.setOptions({
      gfm: true,
      tables: true,
      highlight: function (code) {
        // code.addClass('hjlj')
        return hljs.highlightAuto(code).value;
      }
    });
}]);

;
